/**
 * Represents a sequence in a list
 * 
 * @author Chase Miller
 * 
 */
public class Sequence {
    
    private ListElement listElement;
    private Sequence sequence;
    private String separatorSymbol;
    
    /**
     * Construct a sequence that contains a list element and another sequence.
     * Specify the separator symbol (e.g. ,).
     * 
     * @param listElement
     * @param sequence
     * @param separatorSymbol
     */
    public Sequence(ListElement listElement, Sequence sequence,
	    String separatorSymbol) {
	this.listElement = listElement;
	this.sequence = sequence;
	this.separatorSymbol = separatorSymbol;
    }
    
    /**
     * Construct a sequence that contains a list element. Specify the separator
     * symbol (e.g. ,).
     * 
     * @param listElement
     * @param separatorSymbol
     */
    public Sequence(ListElement listElement) {
	this.listElement = listElement;
    }
    
    /**
     * Override toString to return the proper string representation of a
     * sequence.
     */
    public String toString() {
	if (this.sequence != null) {
	    return this.listElement.toString() + this.separatorSymbol
		    + this.sequence.toString();
	} else {
	    return this.listElement.toString();
	}
    }
}
